Strict

Import agfx

Global myTmpScreen:TTmpScreen

Class TAgfx_test_app Extends TFramework

	Method OnCreate:Int()
		
		
		Super.OnCreate()
		
		DISPLAY.SetVirtualSize(320,480)
		Self.fps_On =True
		myTmpScreen = New TTmpScreen		
		myTmpScreen.Prepare()
		
		Return 0
	End

	
End


Class TTmpScreen Extends TScreen
	
	Field spr_tmp:TSprite
	Field spr_main:TSprite
	Field spr_child:TSprite
	Field x:Int=30
	Field y:Int=30
	Field s:Int = 50
	' START when app is created
	Method Start:Void()
		
		IMAGES.Load("sprite.png","sprite_tmp")	
	
	
		Self.spr_tmp = New TSprite("Sprite_00",IMAGES.Find("sprite_tmp"))
		Self.spr_tmp.position.Set(x+s*0,y+s*0)
		
		SPRITES.Add(Self.spr_tmp)
		
		
		Self.spr_tmp = New TSprite("Sprite_01",IMAGES.Find("sprite_tmp"))
		Self.spr_tmp.position.Set(x+s*1,y+s*0)
		Self.spr_tmp.SetRGB(255,0,0)
		Self.spr_tmp.SetScaleEvent(25,0.05,0.05,False,False)
		
		SPRITES.Add(Self.spr_tmp)
		
		Self.spr_tmp = New TSprite("Sprite_02",IMAGES.Find("sprite_tmp"))
		Self.spr_tmp.position.Set(x+s*2,y+s*0)
		Self.spr_tmp.SetRGB(255,255,0)
		Self.spr_tmp.SetScaleEvent(25,0.05,0.05,True,False)
		
		SPRITES.Add(Self.spr_tmp)
		
		
		Self.spr_tmp = New TSprite("Sprite_03",IMAGES.Find("sprite_tmp"))
		Self.spr_tmp.position.Set(x+s*0,y+s*1)
		Self.spr_tmp.SetRGB(255,0,255)
		Self.spr_tmp.SetScaleEvent(25,0.05,0.05,True,True)
		
		SPRITES.Add(Self.spr_tmp)
		
		Self.spr_tmp = New TSprite("Sprite_04",IMAGES.Find("sprite_tmp"))
		Self.spr_tmp.position.Set(x+s*1,y+s*1)
		Self.spr_tmp.SetRGB(255,255,0)
		
		
		SPRITES.Add(Self.spr_tmp)
		
		
		' print sprite list
		'SPRITES.Dump()
		#Rem
		For Local x:Int = 0 to 10
			For Local y:Int = 0 to 10
				Self.spr_tmp = New TSprite(IMAGES.Find("sprite_tmp"))
				Self.spr_tmp.position.Set(20+x*20,20+y*20)
				Self.spr_tmp.scale.Set(0.5,0.5)
				Self.spr_tmp.SetScaleEvent(25,0.05,0.05,True,False)
				SPRITES.Add(Self.spr_tmp,"test_"+x+y)
			Next

		Next
		#End
		
	End
	
	' main app logic loop update
	Method Update:Void()
		
		SPRITES.Get("Sprite_04").LookAt(MOUSE.x,MOUSE.y)
		
	End
	
	' main app render loop
	Method Render:Void()
		Cls
		
	End
End







